﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using PlugNT.Custom;
using PlugNT.Cms.Core;
using PlugNT.Cms.Model;
using PlugNT.Cms.BLL;
using PlugNT.Cms.Page;

namespace PlugNT.Cms.Web.Admin.Pre_Systems
{
    public partial class SqlList : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            //权限检测
            this.CheckPower();

            if (!IsPostBack)
            {
                Repeater_admin_bind();
            }
        }

        private void Repeater_admin_bind()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("sqlkey");
            dt.Columns.Add("sqlstr");
            if (WebConfig.SqlKeyValues != null)
            {
                foreach (KeyValuePair<string, string> keyValue in WebConfig.SqlKeyValues)
                {
                    DataRow dr=dt.NewRow();
                    dr["sqlkey"] = keyValue.Key;
                    dr["sqlstr"] = keyValue.Value;
                    dt.Rows.Add(dr);
                }
            }
            Repeater_admin.DataSource = dt.DefaultView;
            Repeater_admin.DataBind();
        }


        //private void BindData()
        //{
        //    if (WebConfig.SqlKeyValues != null)
        //    {
        //        StringBuilder sb = new StringBuilder();
        //        foreach (KeyValuePair<string, string> keyValue in WebConfig.SqlKeyValues)
        //        {
        //            sb.AppendLine("<tr class=\"td_on\" onmouseover=\"this.className='td_off'\" onmouseout=\"this.className='td_on'\">");
        //            sb.AppendLine("<td>" + keyValue.Key + "</td>");
        //            sb.AppendLine("<td>" + keyValue.Value + "</td>");
        //            sb.AppendLine("<td align=\"center\"><a href='EditSqls.aspx?t=edit&name=" + keyValue.Key + "&value=" + keyValue.Value + "'>修改</a> &nbsp;");
        //            sb.AppendLine("<a href='EditSqls.aspx?t=delete&name=" + keyValue.Key + "' onclick=\"return CheckSubmit('删除');\">删除</a></td>");
        //            sb.AppendLine("</tr>");
        //        }
        //        litSqls.Text = sb.ToString();
        //    }
        //    else
        //    {
        //        litSqls.Text = "null";
        //    }
        //}



    }
}
